package com.example.intentac;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SecondActivity extends AppCompatActivity implements View.OnClickListener {
    Button button;
    TextView textView;
    int i = 30;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        initview();
    }

    private void initview() {
        button = findViewById(R.id.button2);
        textView = findViewById(R.id.textView4);
        textView.setText("你已经来过了");
        textView.setTextSize(i++);
        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent(SecondActivity.this, MainActivity.class);
        intent.putExtra("data", "我是第二个页面");
        /**
         *
         */
        setResult(2,intent);
        finish();
//        startActivity(intent);

    }
    private void  initevents(){
        Intent intent = getIntent();
        String firstSrt = intent.getStringExtra("name");
        textView.setText(firstSrt);
    }
}
